<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php 
	$tv="select * from dm_sanpham,dm_hang where idsp='$_GET[id]' and dm_sanpham.idh=dm_hang.idh";
	$tv_1=mysql_query($tv);
	$tv_2=mysql_fetch_array($tv_1);
	$tenhang=$tv_2['tenhang'];
	$maloai=$tv_2['maloai'];
	$ten=$tv_2['tensp'];
	$link_hinh="../image/ha_sp/".$tv_2['hinh'];
	$gia=$tv_2['gia'];
	$soluong=$tv_2['soluong'];
	$thongtin=$tv_2['thongtin'];
	$km=$tv_2['km'];
	$anhht=$tv_2['hinh'];
	$thongtin=str_replace("\n","",$thongtin);
	$thongtin=str_replace("\r","",$thongtin);
	$thongtin=str_replace("\t","",$thongtin);
	$thongtin=str_replace("'","\'",$thongtin);
?>
<table width="990px" id="er" style="margin-top:6px" border="1">
	<tr>
		<td align="right">
        <div style="float:left; text-align:left; width:50%;">
			<span class="span__16"></span>
			<a a href="?home" class="nut_dong" style="color:red">
				Trang Chủ
			</a>
        </div>
        <div style="float:left; text-align:right;width:50%;">
			<span class="span__16"></span>
			<a a href="?thamso=quanly" class="nut_dong" style="color:red">
				Đóng
			</a>
        </div>
		</td>
	</tr>
	<tr>
		<td>
			<form action="" method="post" enctype="multipart/form-data">
				<table width="976px" border="0" id="er_2" style="margin:6px" >
					<tr>
						<td width="150px">
							<b>Hãng Máy:</b>
						</td>
						<td>
							<?php 
									$sql="select * from dm_hang";
									$sql1=mysql_query($sql);
									//$data=mysql_fetch_row($sql1);
									echo "<select name='hang'>";
									while ($data=mysql_fetch_array($sql1))
									{
										if ($data['tenhang']!=$tenhang)
										{
										echo "<option value='".$data['idh']."'>".$data['tenhang']."</option>";
										}
										else
										{
										echo "<option value='".$data['idh']."' selected='selected'>".$data['tenhang']."</option>";
										}
									}
									echo "</select>";
									?>
						</td>
					</tr>
                    <tr>
						<td width="150px">
							<b>Loại máy:</b>
						</td>
						<td>
							<?php 
									$sql="select * from dm_loai";
									$sql1=mysql_query($sql);
									//$data=mysql_fetch_row($sql1);
									echo "<select name='loai'>";
									while ($data=mysql_fetch_array($sql1))
									{
										
										if ($data['maloai']!=$maloai)
										{
										echo "<option value='".$data['maloai']."'>".$data['tenloai']."</option>";
										}
										else
										{
										echo "<option value='".$data['maloai']."' selected='selected'>".$data['tenloai']."</option>";
										}
										

									}
									echo "</select>";
									?>
						</td>
					</tr>
					<tr>
						<td>
							<b>Tên :</b>
						</td>
						<td>
							<input size="70" name="tensp" value="<?php echo $ten;?>">
						</td>
					</tr>
					<tr>
						<td>
							<b>Hình ảnh :</b>
						</td>
						<td>
                        	<img src="<?php echo $link_hinh; ?>" width="90px" height="90px" border="0"/>
							<input name="hinh_anh" type="file" >
                            <input type="hidden" name="idsp__cc" value="<?php echo $tv_2['idsp']; ?>">
                            <input type="hidden" name="hidden_hinh_anh" value="<?php echo $anhht; ?>">
						</td>
					</tr>
					<tr>
						<td>
							<b>Giá bán : </b>
						</td>
						<td>
							<input size="70" name="gia" value="<?php echo $gia;?>" onKeyPress='if((event.keyCode< 48)|| (event.keyCode > 57)) event.returnValue =false'>
						</td>
					</tr>
                    <tr>
						<td>
							<b>Số lượng : </b>
						</td>
						<td>
							<input size="70" name="sl" value="<?php echo $soluong;?>" onKeyPress='if((event.keyCode< 48)|| (event.keyCode > 57)) event.returnValue =false'>
						</td>
					</tr>
					<tr>
						<td colspan="2">
							<center><b>Nội dung</b></center>
							<br>
							<center>
								<script type="text/javascript">
									var oFCKeditor = new FCKeditor('noi_dung') ;
									oFCKeditor.BasePath	= "fckeditor/" ;
									oFCKeditor.Height	= 300 ;
									oFCKeditor.Width	= 960 ;
									oFCKeditor.Value	= '<?php echo $thongtin;?>' ;
									oFCKeditor.Config["EnterMode"]= "br" ;
									oFCKeditor.Create("") ;
								</script>
							</center>
						</td>
					</tr>
                    <tr>
						<td>
							<b>Khuyến mại : </b>
						</td>
						<td>
							<input size="70" name="km">
						</td>
					</tr>
					<tr>
						<td>&nbsp;
							
						</td>
						<td>
							<input type="hidden" name="sua_san_pham" value="sua_san_pham">
							<!--<input type="submit" value="Chấp nhận">-->
							<input type="image" src="hinhanh/sua.gif" style="border:0px solid red">
			
						</td>
					</tr>
				</table>
			</form>
		</td>
	</tr>
</table>
<script>
	table_css_1("er");
	table_css("er_2");
</script>